# -*- coding: utf-8 -*-
# @Time    : 2023/11/8 0008 9:44
# @Author  : zcj
# @File    : datetime_util.py.py
# @Software : PyCharm
import time
from datetime import datetime, timedelta


# 返回中文格式的日期：xxxx年xx月xx日
def get_chinese_date():  # 2024年06月20日
    year = time.localtime().tm_year
    if len(str(year)) == 1:
        year = "0" + str(year)
    month = time.localtime().tm_mon

    if len(str(month)) == 1:
        month = "0" + str(month)
    day = time.localtime().tm_mday
    if len(str(day)) == 1:
        day = "0" + str(day)
    return "{}年{}月{}日".format(year, month, day)


# 返回英文格式的日期：xxxx/xx/xx
def get_english_date():  # 2024/06/20
    year = time.localtime().tm_year
    if len(str(year)) == 1:
        year = "0" + str(year)
    month = time.localtime().tm_mon
    if len(str(month)) == 1:
        month = "0" + str(month)
    day = time.localtime().tm_mday
    if len(str(day)) == 1:
        day = "0" + str(day)
    return "{}/{}/{}".format(year, month, day)

    # 返回中文格式的时间：xx时xx分xx秒


def get_chinese_time():  # 11时18分11秒
    hour = time.localtime().tm_hour
    if len(str(hour)) == 1:
        hour = "0" + str(hour)
    minute = time.localtime().tm_min
    if len(str(minute)) == 1:
        minute = "0" + str(minute)
    second = time.localtime().tm_sec
    if len(str(second)) == 1:
        second = "0" + str(second)
    return "{}时{}分{}秒".format(hour, minute, second)

    # 返回英文格式的时间：xx:xx:xx


def get_english_time():  # 11:17:39
    hour = time.localtime().tm_hour
    if len(str(hour)) == 1:
        hour = "0" + str(hour)
    minute = time.localtime().tm_min
    if len(str(minute)) == 1:
        minute = "0" + str(minute)
    second = time.localtime().tm_sec
    if len(str(second)) == 1:
        second = "0" + str(second)
    return "{}:{}:{}".format(hour, minute, second)

    # 返回中文格式的日期时间


def get_chinese_datetime():  # 2024年06月20日 11时16分07秒
    return get_chinese_date() + " " + get_chinese_time()

    # 返回英文格式的日期时间


def get_english_datetime():  # 2024/06/20 11:16:07
    return get_english_date() + " " + get_english_time()

    # 返回时间戳


def get_timestamp():  # 20240620_111607
    year = time.localtime().tm_year
    if len(str(year)) == 1:
        year = "0" + str(year)
    month = time.localtime().tm_mon
    if len(str(month)) == 1:
        month = "0" + str(month)
    day = time.localtime().tm_mday
    if len(str(day)) == 1:
        day = "0" + str(day)
    hour = time.localtime().tm_hour
    if len(str(hour)) == 1:
        hour = "0" + str(hour)
    minute = time.localtime().tm_min
    if len(str(minute)) == 1:
        minute = "0" + str(minute)
    second = time.localtime().tm_sec
    if len(str(second)) == 1:
        second = "0" + str(second)
    return "{}{}{}_{}{}{}".format(year, month, day, hour, minute, second)


def strf_time():  # 2024-06-20 11:16:07
    # 获取当前日期和时间
    now = datetime.now()

    # 格式化日期和时间
    formatted_date = now.strftime("%Y-%m-%d %H:%M:%S")
    return formatted_date


def strf_time_add(x=5):  # 2024-06-20 11:16:07
    # 获取当前日期和时间
    now = datetime.now() + timedelta(minutes=int(x))

    # 格式化日期和时间
    formatted_date = now.strftime("%Y-%m-%d %H:%M:%S")
    return formatted_date


def strf_time_minus(x=5):  # 2024-06-20 11:16:07
    # 获取当前日期和时间
    now = datetime.now() - timedelta(minutes=int(x))

    # 格式化日期和时间
    formatted_date = now.strftime("%Y-%m-%d %H:%M:%S")
    return formatted_date


def tomo():  # 2024-06-21 11:16:07
    # 获取今天的日期
    today = datetime.now()

    # 计算明天的日期
    tomorrow = today + timedelta(days=1)

    # 打印明天的日期
    return tomorrow.strftime('%Y-%m-%d %H:%M:%S')


def today():  # 06-20
    # 获取当前日期
    now = datetime.now()

    # 格式化日期和时间
    formatted_date = now.strftime("%m-%d")
    return formatted_date


def today_end():  # 2024-06-20 23:59:59
    # 获取当前日期和时间
    now = datetime.now()

    # 格式化日期和时间
    formatted_date = now.strftime("%Y-%m-%d 23:59:59")
    return formatted_date


def midnight_time():  # 2024-06-20 00:00:00
    # 获取当前日期和时间
    now = datetime.now()

    # 格式化日期和时间
    formatted_date = now.strftime("%Y-%m-%d 00:00:00")
    return formatted_date


if __name__ == '__main__':
    print(tomo())
